package com.dbb.tag;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;
import org.springside.modules.orm.Page;

import com.opensymphony.xwork2.util.ValueStack;

public class PageTag extends ComponentTagSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = -6212631694044796798L;
	private Page<?> page;
	private int pageNum;

	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public Component getBean(ValueStack arg0, HttpServletRequest arg1, HttpServletResponse arg2) {
		return new PageComponent(arg0);
	}

	protected void populateParams() {
		super.populateParams();
		PageComponent pageComponent = (PageComponent) component;
		pageComponent.setPage(page);
		pageComponent.setPageNum(pageNum);
//		jtime.setMessage(message);
	}

}
